// pages/service/service.js
Page({
  AmName:'',
  blockName:'',
  roleStatus:'',
  onClickdj(event){
    console.log("登记点击");
    wx.navigateTo({
      url: '../visitorCheckIn/visitorCheckIn',
    })
  },
  onClickphone(event){
    console.log("电话点击");
  },
  onClickhelp(event){
    wx.navigateTo({
      url: '../AbnormalSubmit/AbnormalSubmit',
    })
  },
  onClickdkhistory(event){
    console.log("打卡记录");
  },
  onClickwlsp(event){
    console.log("外来审批");
    wx.navigateTo({
      url: '../vistiorApproval/visitorApproval',
    })
  },

  onClickdkAbnormal(event){
    wx.navigateTo({
      url: '/pages/Manager/dkAbnormalList/dkAbnormalList',
    })
  },
  onClickabnormalHelp(event){
    wx.navigateTo({
      url: '/pages/Manager/abnormalHelpList/abnormalHelpList',
    })
  },
  onClickUserInfo(event){
    console.log("点击业主信息")
  },

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    if(wx.getStorageSync('role')=='user'){
      that.setData({
        roleStatus:'1'
      })
    }else if(wx.getStorageSync('role')=='manager'){
      that.setData({
        roleStatus:'2'
      })

    }
    usercache:wx.getStorageSync('usercache')
    if(this.data.roleStatus==1){
      wx.request({
        url: 'http://localhost/Wx/courtInfo',
        method:'post',
        header:{
          "Content-Type": "application/x-www-form-urlencoded"
        },
        data:{
          openid:wx.getStorageSync('openid')
        },
        success(res){
          console.log(res)
          that.setData({
            AmName:res.data.data.am_name,
            blockName:res.data.data.blockName,
          })
        }
      })
    }
  },
    
  onClickdaka(event){
    wx.navigateTo({
      url: '/pages/htclockin/htclockin',
    })
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})